package com.acwing.partition12;

import java.io.*;

/**
 * @author `RKC`
 * @date 2021/12/31 10:07
 */
public class AC1112迷宫 {

    private static final int N = 110;
    private static char[][] graph = new char[N][N];
    private static int startX = 0, startY = 0, endX = 0, endY = 0;
    private static int n = 0;
    private static final int[][] dirs = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
    private static boolean[][] visited = new boolean[N][N];

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        int k = Integer.parseInt(reader.readLine());
        while (k-- > 0) {
            n = Integer.parseInt(reader.readLine());
            for (int i = 0; i <= n; i++) {
                for (int j = 0; j <= n; j++) visited[i][j] = false;
            }
            for (int i = 0; i < n; i++) {
                String s = reader.readLine();
                for (int j = 0; j < n; j++) graph[i][j] = s.charAt(j);
            }
            String[] s = reader.readLine().split("\\s+");
            startX = Integer.parseInt(s[0]);
            startY = Integer.parseInt(s[1]);
            endX = Integer.parseInt(s[2]);
            endY = Integer.parseInt(s[3]);
            if (dfs(startX, startY)) writer.write("YES\n");
            else writer.write("NO\n");
        }
        writer.flush();
    }

    private static boolean dfs(int x, int y) {
        if (graph[x][y] == '#') return false;
        visited[x][y] = true;
        if (x == endX && y == endY) return true;
        for (int[] dir : dirs) {
            int nextX = x + dir[0], nextY = y + dir[1];
            if (nextX < 0 || nextX >= n || nextY < 0 || nextY >= n) continue;
            if (visited[nextX][nextY] || graph[nextX][nextY] == '#') continue;
            if (dfs(nextX, nextY)) return true;
        }
        return false;
    }
}
